package com.zhuiyun.educations.api.homepage.controller;

import com.zhuiyun.educations.api.homepage.entity.Rotaion;
import com.zhuiyun.educations.api.homepage.service.CourseVoService;
import com.zhuiyun.educations.api.newCourse.entity.CourseUnit;
import com.zhuiyun.educations.api.newCourse.entity.DTO.CourseDTO;
import com.zhuiyun.educations.api.newCourse.entity.UnitJoint;
import com.zhuiyun.educations.common.response.CommonResult;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName CourseVoController
 * @Description TODO
 * @Author yuanb
 * @Date 2023/6/21 11:37
 **/
@RestController
@RequestMapping("/conrse")
@Slf4j
@CrossOrigin
public class CourseVoController {

    @Autowired
    private CourseVoService courseVoService;
    /**
    * @Author MJL
    * @Description todo pc端获取精选课数据
    * @Date 2023/6/28 15:37
    * @Return  * @param null
    */
    @GetMapping("homePageSelected")
    @ApiOperation(value = "pc端首页获取精选课数据")
    public CommonResult homePageSelected(){
        return courseVoService.homePageSelected();
    }
    /**
     * @Author MJL
     * @Description todo pc端获取精选课数据
     * @Date 2023/6/28 15:37
     * @Return  * @param null
     */
    @GetMapping("homePageSelectedById")
    @ApiOperation(value = "pc端首页获取精选课数据")
    public CommonResult homePageSelectedById(Integer id){
        return courseVoService.homePageSelectedById(id);
    }
    /**
     * @Author MJL
     * @Description todo pc端获取精选课数据
     * @Date 2023/6/28 15:37
     * @Return  * @param null
     */
    @GetMapping("homePageUnitById")
    @ApiOperation(value = "pc端首页获取精选课数据")
    public CommonResult homePageUnitById(Integer id) {
        //根据课程id查章节


        return CommonResult.ok(courseVoService.homePageUnitById(id));
    }
    /**
     * @Author MJL
     * @Description todo pc端获取精选课数据
     * @Date 2023/6/28 15:37
     * @Return  * @param null
     */
    @GetMapping("homePageJointById")
    @ApiOperation(value = "pc端首页获取精选课数据")
    public CommonResult homePageJointById(Integer id){
        return CommonResult.ok(courseVoService.homePageJointById(id));
    }
   /**
       * @Author yuanb
       * @Description pc端首页活数据
       * @Date 2023/6/21 14:34
       * @Return com.zhuiyun.educations.common.response.CommonResult
       *
   */
    @GetMapping("/homePageAllFree")
    @ApiOperation(value = "pc端首页活数据免费数据")
    public CommonResult homePageAllFree(){
        return courseVoService.homePageAllFree();
    }
    /**
     * @Author yuanb
     * @Description pc端首页活数据
     * @Date 2023/6/21 14:34
     * @Return com.zhuiyun.educations.common.response.CommonResult
     *
     */
    @GetMapping("/homePageAllcharge")
    @ApiOperation(value = "pc端首页活数据免费数据")
    public CommonResult homePageAllcharge(){
        return courseVoService.homePageAllcharge();
    }

    /**
    * @Author MJL
    * @Description pc端新课推荐数据
    * @Date 2023/6/27 15:36
    * @Return  * @param null
    */
    @GetMapping("/homePageNewAllCharge")
    @ApiOperation(value = "pc端新课推荐数据")
    public CommonResult homePageNewAllCharge () {
        return courseVoService.homePageNewAllCharge();
    }

    /**
    * @Author MJL
    * @Description todo pc端微专业数据
    * @Date 2023/6/27 20:34
    * @Return  * @param null
    */
    @GetMapping("/homePageMicroAllCharge")
    @ApiOperation(value = "pc端微专业数据")
    public CommonResult homePageMicroAllCharge(){
        return courseVoService.homePageMicroAllCharge();
    }

    /**
        * @Author yuanb
        * @Description pc端首页轮播图数据
        * @Date 2023/6/21 20:00
        * @Return com.zhuiyun.educations.common.response.CommonResult
    */
    @GetMapping("/RotaionAll")
    @ApiOperation(value = "pc端首页轮播图数据")
    public CommonResult CarouselAll(Rotaion rotaion){
        return courseVoService.CarouselAll(rotaion);
    }

    /**
    * @Author MJL
    * @Description todo 大课程分类
    * @Date 2023/6/29 11:05
    * @Return  * @param null
    */
    @GetMapping("/BigClassList")
    @ApiOperation(value = "pc端大课程分类")
    public CommonResult BigClassList(){
        return courseVoService.BigClassList();
    }
    /**
    * @Author MJL
    * @Description todo pc端小课程数据
    * @Date 2023/6/29 13:58
    * @Return  * @param null
    */
    @GetMapping("/SmallClassList")
    @ApiOperation(value = "pc端小课程数据")
    public CommonResult SmallClassList(Integer subjectId){
        return courseVoService.SmallClassList(subjectId);
    }

    @GetMapping("/selectCourseInfo")
    public CommonResult selectCourseInfo(Integer id){
        return CommonResult.ok(courseVoService.selectCourseInfo(id));
    }
}
